import React from 'react';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import { List, Icon, ActivityIndicator } from 'antd-mobile';
import content from '../../../common/contentCss/content.css';
import CustTitle from '../../../common/title/title';
import PutLoginPassword from './pages/putLoginPassword/putLoginPassword';
// import styles from './common.css';

function LoginPassword({dispatch,loading,loginPassword}) {

  const titleProps = {
    titleName:'修改密码',
    goBack(){
      dispatch(routerRedux.goBack());
    }
  }

  const PutLoginPasswordProps = {
    onSubmit(oldPassword, newPassword){
      dispatch({
        type:'loginPassword/subRestPassword',
        payload:{
          oldPassword,
          newPassword
        }
      });
    }
  }


  const MarginHeight = () => <div style={{height: '0.6em', backgroundColor:'#F5F5F9'}}></div>;

  return(
    <div className={content.content} style={{backgroundColor:'#fff'}}>
      <CustTitle {...titleProps}/>
      <div style={{
        marginTop: '2.8125em',
      }}>
      </div>

      <PutLoginPassword {...PutLoginPasswordProps} />
      <ActivityIndicator
        toast
        text=""
        animating={loading}
      />
    </div>
  )
}

function mapStateToProps(state, ownProps) {
  return {
    loading: state.loading.global,
    loginPassword: state.loginPassword
  }
}

export default connect(mapStateToProps)(LoginPassword);
